[rate-limit-controller] Fix and improve typing, remove any usage#3963
Merged
Conversation
2a01660 to
467f92a
Compare
467f92a to
380371b
Compare
any usage
10f68ab to
b35b77a
Compare
e9e54f7 to
0aed2b9
Compare
Mrtenz
previously approved these changes
Feb 26, 2024
MajorLift
commented
Feb 26, 2024
Contributor
Author
There was a problem hiding this comment.
args should represent the result of querying RateLimitedApis with the specific type passed in as the second argument, not all possible Api types stored in state.
keyof RateLimitedApis is only the constraint for the type param, not its type.
legobeat
reviewed
Feb 27, 2024
0aed2b9 to
b393656
Compare
mcmire
reviewed
Mar 5, 2024
Contributor
mcmire
left a comment
There was a problem hiding this comment.
Overall looks good, just had some minor comments.
Contributor
|
@MajorLift I'm assuming we want to wait until the parent PR is merged before merging this, correct? |
…in, not all possible api types stored in state. `keyof RateLimitedApis` is only the constraint for the `type` param, not its type.
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
66e78b8 to
244325e
Compare
Mrtenz
approved these changes
Mar 7, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
anyusage and more typing fixes and improvements.RateLimitedApiMap,RateLimitedRequestsfor readability and clarity.GetRateLimitState->RateLimitControllerGetStateAction.RateLimitStateChange->RateLimitControllerStateChangeEvent.CallApi->RateLimitControllerCallApiAction.References
rate-limit-controller: Replace use ofanywith proper types (non-test files only) #3729Changelog
@metamask/rate-limit-controllerAdded
RateLimitedApiMap,RateLimitedRequests. (#3963)RateLimitedApiMaprepresents the type of theRateLimitedApisgeneric parameter used throughout the controller.RateLimitedRequestsrepresents the type of therequestproperty ofRateLimitState.Changed
GetRateLimitStateis nowRateLimitControllerGetStateAction.RateLimitStateChangeis nowRateLimitControllerStateChangeEvent.CallApiis nowRateLimitControllerCallApiAction.@metamask/utils^8.3.0as a dependency. (#3963)Checklist